﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LibFriesland_Campina_CRM
{
    public class BizNaShop
    {
        #region Thuoc tinh
        public string by_na { get; set; }
        public string by_shift { get; set; }
        public string shift_name { get; set; }
        public string by_shop { get; set; }
        public string shop_name { get; set; }
        public string na_name { get; set; }
        #endregion

        #region Ham thiet lap
        public BizNaShop() { }
        public BizNaShop(string pBy_na, string pBy_shift, string pShift_name, string pBy_shop) 
        {
            by_na = pBy_na;
            by_shift = pBy_shift;
            shift_name = pShift_name;
            by_shop = pBy_shop;
        }
        public BizNaShop(string pBy_na, string pBy_shift, string pShift_name, string pBy_shop, string pShop_name)
        {
            by_na = pBy_na;
            by_shift = pBy_shift;
            shift_name = pShift_name;
            by_shop = pBy_shop;
            shop_name = pShop_name;
        }

        public BizNaShop(string pBy_na, string pNa_name, string pBy_shift, string pShift_name, string pBy_shop, string pShop_name)
        {
            by_na = pBy_na;
            na_name = pNa_name;
            by_shift = pBy_shift;
            shift_name = pShift_name;
            by_shop = pBy_shop;
            shop_name = pShop_name;
        }
        #endregion

        #region Phuong thuc
        //Lay danh sach cac ca lam viec cua tat ca NA
        public static List<BizNaShop> getAll()
        {
            return DalNaShop.getAll();
        }

        //Lay danh sach ca lam viec cua NA theo Supervisor
        public static List<BizNaShop> getShiftNAbySup(string pBy_sup)
        {
            return DalNaShop.getShiftNAbySup(pBy_sup);
        }

        //Lay danh sach NA ca lam viec cua NA theo Shop, Sup
        public static List<BizNaShop> getShiftNAbyShopSup(string pBy_shop, string pBy_sup)
        {
            return DalNaShop.getShiftNAbyShopSup(pBy_shop, pBy_sup);
        }

        //Lay danh sach Shop lam viec cua NA theo Supervisor
        public static List<BizShop> getShopNAbySup(string pBy_sup)
        {
            return DalNaShop.getShopNAbySup(pBy_sup);
        }
        #endregion

        #region Dung cho Webservice
        //Lay danh sach ca lam viec
        public static List<BizNaShop> getShiftbyNA(string pNa_charid)
        {
            return DalNaShop.getShiftbyNA(pNa_charid);
        }

        //Lay danh sach shop ma NA lam viec
        public static List<BizShop> getShopbyNA(string pNa_charid)
        {
            return DalNaShop.getShopbyNA(pNa_charid);
        }

        //lay danh sach ca lam viec cua NA tai shop
        public static List<BizShift> getShiftbyNAShop(string pNa_charid, string pShop_charid)
        {
            return DalNaShop.getShiftbyNAShop(pNa_charid, pShop_charid);
        }
        #endregion
    }

    public class NaShopSort : IComparable<BizNaShop>
    {
        public int CompareTo(BizNaShop other) { return 1; }
        public static Comparison<BizNaShop> byShopComparison = delegate(BizNaShop p1, BizNaShop p2)
        {
            int temp = p1.by_shop.CompareTo(p2.by_shop);
            if (temp == 0)
            {
                return p1.by_shift.CompareTo(p2.by_shift);
            }
            return temp;
        };

        public static Comparison<BizNaShop> byNaComparison = delegate(BizNaShop p1, BizNaShop p2)
        {
            int temp = p1.by_na.CompareTo(p2.by_na);
            if (temp == 0)
            {
                return p1.by_shift.CompareTo(p2.by_shift);
            }
            return temp;
        };
    }
}
